package cn.bdqn.fin.controller;

import cn.bdqn.fin.model.Invoice;
import cn.bdqn.fin.service.InvoiceService;
import cn.bdqn.model.PageBean;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author gurilla
 * @create 2019-08-23 15:35
 */
@Controller
@RequestMapping("/fin/invoice")
public class InvoiceController {
    //调用
    @Resource
    private InvoiceService invoiceService;

    @RequiresPermissions("fin:invoice:page")
    @GetMapping
    public String topage(){
        return "/fin/invoice";
    }

    @RequiresPermissions("fin:invoice:list")
    @PostMapping("list")
    @ResponseBody
    public Object list(PageBean pageBean, String taxNo){
        return invoiceService.list(pageBean, taxNo);
    }

    @RequiresPermissions("fin:invoice:save")
    @PostMapping("save")
    @ResponseBody
    public Object save(Invoice invoice){
        return invoiceService.save(invoice);
    }
}
